import java.util.Objects;

class Person{
    public String id;

    public Person(String id) {
        this.id = id;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Objects.equals(id, person.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "Person{" +
                "id='" + id + '\'' +
                '}';
    }
}
public class Test {
    public static void main(String[] args) {
        Person person1 = new Person("1234");
        Person person2 = new Person("1234");
        //hashCode会把这个对象变成整数
        //System.out.println(person1.hashCode());
        //System.out.println(person2.hashCode());

        HashBucket1<Person,String> hashBucket1 = new HashBucket1<>();
        hashBucket1.put(person1,"阿娇");
        //因为重写了hashCode 所以person1和person2是一样的
        String name = hashBucket1.get(person2);
        System.out.println(name);
    }

    public static void main2(String[] args) {
        HashBucket hashBucket = new HashBucket();
        hashBucket.put(1,11);
        hashBucket.put(2,22);
        hashBucket.put(12,122);
        hashBucket.put(3,33);
        hashBucket.put(4,44);
        hashBucket.put(14,144);
        hashBucket.put(5,55);
        hashBucket.put(16,166);
        System.out.println(hashBucket.get(5));
    }


    public static void main1(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        int[] array = {12,4,5,10,8};
        for(int x : array) {
            binarySearchTree.insert((x));
        }
        binarySearchTree.insert(3);
        binarySearchTree.removeNode(4);
        System.out.println("1");
    }
}
